/**
 * Created by Francis.LW on 2017/10/20.
 *
 * 工单模板服务接口
 */
import {postRequest, getRequest} from '@/common/request'
import {urls} from './url'

const electronicWorksheetsTemplateApi = urls.electronicWorksheetsTemplate

function listAllElectronicWorksheetsTemplate(param, success, complete) {
  postRequest(electronicWorksheetsTemplateApi.listAllElectronicWorksheetsTemplate, {}, param, success, complete)
}

function listElectronicWorksheetsTemplate(param, page, pageSize, success, complete) {
  postRequest(electronicWorksheetsTemplateApi.listElectronicWorksheetsTemplate + '?currentpage=' + page + '&pagesize=' + pageSize, {}, param, success, complete)
}

function addElectronicWorksheetsTemplate(param, success, complete) {
  postRequest(electronicWorksheetsTemplateApi.addElectronicWorksheetsTemplate, {}, param, success, complete)
}

function updateElectronicWorksheetsTemplate(id, param, success, complete) {
  postRequest(electronicWorksheetsTemplateApi.updateElectronicWorksheetsTemplate + id, {}, param, success, complete)
}

function updateUseRange(id, useRange, success, complete) {
  postRequest(electronicWorksheetsTemplateApi.updateUseRange + id, {useRange: useRange}, {}, success, complete)
}

function getElectronicWorksheetsTemplate(id, success, complete) {
  getRequest(electronicWorksheetsTemplateApi.getElectronicWorksheetsTemplate + id, {}, success, complete)
}

function removeElectronicWorksheetsTemplate(ids, success, complete) {
  postRequest(electronicWorksheetsTemplateApi.removeElectronicWorksheetsTemplate, {}, ids, success, complete)
}

function deleteSingleElectronicWorksheetsTemplate(id, success, complete) {
  let ids = []
  ids.push(id)
  removeElectronicWorksheetsTemplate(ids, success, complete)
}

export default {
  listAllElectronicWorksheetsTemplate,
  listElectronicWorksheetsTemplate,
  addElectronicWorksheetsTemplate,
  updateElectronicWorksheetsTemplate,
  updateUseRange,
  getElectronicWorksheetsTemplate,
  removeElectronicWorksheetsTemplate,
  deleteSingleElectronicWorksheetsTemplate
}
